import request from '@/utils/requist'

// 个人中心
export const userdetail = () => {
  return request({
    method: 'get',
    url: '/api/user/detail'
  })
}

export const collect = ({
  page,
  per_page,
  classify,
  choice
}) => {
  return request({
    method: 'post',
    url: '/api/user/collect ',
    data: {
      page,
      per_page,
      classify,
      choice
    }
  })
}

// 取消收藏
export const ddelete = ({
  id,
  classify,
  choice
}) => {
  return request({
    method: 'post',
    url: '/api/user/delete ',
    data: {
      id,
      classify,
      choice
    }
  })
}


// 手机号验证码
export const ser_code = ({
  mobile
}) => {
  return request({
    method: 'post',
    url: '/api/user/user_code ',
    data: {
      mobile
    }
  })
}


// 更改手机号
export const phoneChange = ({
  mobile,
  sms_code
}) => {
  return request({
    method: 'post',
    url: '/api/user/phoneChange ',
    data: {
      mobile,
      sms_code
    }
  })
}


// 邮箱验证码
export const email_code = ({
  email
}) => {
  return request({
    method: 'post',
    url: '/api/user/email_code ',
    data: {
      email
    }
  })
}

// 更改邮箱确定
export const changeEmail = ({
  email,
  email_code
}) => {
  return request({
    method: 'post',
    url: '/api/user/changeEmail ',
    data: {
      email,
      email_code
    }
  })
}


// 更改密码
export const changepassword = ({
  password,
  repassword,
  newpass
}) => {
  return request({
    method: 'post',
    url: '/api/user/changepassword ',
    data: {
      password,
      repassword,
      newpass
    }
  })
}

// 提交
export const personal = ({
  real_name,
  age,
  sex,
  name
}) => {
  return request({
    method: 'post',
    url: '/api/user/personal ',
    data: {
      real_name,
      age,
      sex,
      name
    }
  })
}
